﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Model;
using System.Data;
using System.Data.SqlClient;
namespace DAL
{
   public class Awards_奖项_DAL
    {
       SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=JingRui;Integrated Security=True");
       /// <summary>
       /// 显示奖项
       /// </summary>
       /// <returns></returns>
       public List<Awards_奖项_> ShowAwards()
       {
           using (SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=JingRui;Integrated Security=True"))
           {
               con.Open();
               string sql = "select * from [Awards(奖项)]";
               SqlCommand com = new SqlCommand(sql,con);
               SqlDataAdapter sd = new SqlDataAdapter(com);
               DataTable dt = new DataTable();
               sd.Fill(dt);
               List<Awards_奖项_> list = new List<Awards_奖项_>();
               foreach (DataRow item in dt.Rows)
               {
                   Awards_奖项_ a = new Awards_奖项_();
                   a.Awardsid = Convert.ToInt32(item["Awardsid"]);
                   a.Awardsimg = item["Awardsimg"].ToString();
                   a.Awardsjianjie = item["Awardsjianjie"].ToString();
                   list.Add(a);
               }
               return list;

           }
       }
    }
}
